home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Extensions / img / README.img
Encoding:
Text File  |  2000-06-23  |  5.4 KB  |  139 lines

  1. Python image file handling, version 1.3 dated XXXXXXX
  2. -------------------------------------------------------
  3.  
  4. This directory contains the source to a number of python modules (both
  5. in C and in python) that support handling of many different image
  6. formats. The modules have been tested on an SGI running Irix 6.3 and
  7. on a Mac running System 7.5, with python 1.4.  They should
  8. be portable, though. All the C-modules should by dynamically loadable.
  9. If you have the new importdl.c that allows multiple modules to live in
  10. one .so file you can use that, but it is also possible to create an
  11. .so file per module.
  12.  
  13. Mac users can download prebuilt dynamically loadable modules via
  14. <http://www.cwi.nl/~jack/macpython.html>.
  15.  
  16. Changes since 1.2
  17. ------------------
  18.  
  19. - PNG support
  20. - BMP support
  21. - XBM support
  22. - imgop.unpack() method for unpacking multiple pixels per byte
  23. - bug fixes
  24.  
  25. Other stuff needed
  26. ------------------
  27.  
  28. The modules need a number of freely available libraries: the pbmplus
  29. library, the tiff library, the IJG JPEG library and the PNG and ZLIB
  30. libraries. For Mac users I have made versions of these libraries
  31. available with project files and such, see
  32. http://www.cwi.nl/~jack/macsoftware.html. For others you can find the
  33. more-or-less original sources (with one exception: see below) at
  34. ftp://ftp.cwi/nl/pub/jack/python-img (where you can also find this
  35. distribution). 
  36.  
  37. Since the pbmplus error handling is not well-suited for use in python
  38. it has been modified. The pbmplus sources mentioned above contain that
  39. fix. Alternatively, you can get libpbm1.c.diff.Z, which contains the
  40. context diff of the fix. The fix, incidentally, is backward
  41. compatible. If you don't want the fix you should #undef PBMNEWERROR in
  42. imgp[pgb]mmodule.c. The effect of this is that an error in your pbm
  43. file will terminate python.
  44.  
  45. When you compile the libraries take care that you use the same C
  46. compiler as for the python distribution.
  47.  
  48. Building
  49. --------
  50.  
  51. The modules build like standard extension modules, see Guido's
  52. documentation on "Extending and embedding the Python
  53. Interpreter". Here's a quick guide for Unix:
  54.  
  55. - Build the jpeg, tiff, pbm, zlib and png libraries.
  56. - Copy Setup.in to Setup and modify it. You have to provide the paths
  57.   to the libraries needed, and you may want to set  BASESETUP and
  58.   BASELIB. Also, SGI users should check the comment near where the
  59.   imgjpeg module is declared, the builtin jpeg module conflicts with
  60.   the cl module (but a python wrapper with the same functionality is
  61.   provided). 
  62. - Build a Makefile, with something like
  63.     make -f Makefile.pre.in boot
  64.  
  65. Testing
  66. -------
  67.  
  68. Go to the test directory and run 'python testimg.py'. This will read
  69. the images in the files starting with 'in-' and produce a number of
  70. files starting with 'out-'. For some image formats, it will also check
  71. that the data read is what is expected, but this cannot be done for
  72. all formats. So, use 'xv' or some other tool to confirm that the
  73. images all look as they should. For example 'out-rgb-b2t.ppm' should
  74. be a ppm file containing a full-color image, upside down. And, yes,
  75. the fella in the NOFX t-shirt is me (two years ago: remove hair and
  76. glasses and fade the T-shirt for a more up-to-date view).
  77.  
  78. There is one warning the test script can currently legally produce:
  79. about the upper byte of SGI RGB images being changed. Ignore it.
  80.  
  81. There is a second test program: xtestview.py. It will test
  82. the image converters by reading each file given on the command line
  83. and displaying it using X. You can specify the visual and depth to
  84. use, check the source. In the display window you can type
  85. Q to go to the next image or W to go to the next image after
  86. attempting to convert the image back to the original format (the
  87. result is a file starting with '@copy-').
  88.  
  89. The third test program, testview.py, is an SGI-only version of
  90. xtestview.py using GL window calls.
  91.  
  92. Documentation
  93. -------------
  94.  
  95. Yes, there is documentation! Copy the file doc/libimg.tex to your
  96. python Doc directory and modify lib.tex to include it. There's some
  97. stuff in the doc directory as well to help you creating documentation
  98. for the img modules only as well.
  99.  
  100. Hacking
  101. -------
  102.  
  103. You are hereby cordially invited to extend the functionality of the
  104. image stuff. If you already have support for some image fileformat and
  105. want to make it available with the interface here look at imgpxxx.py.
  106. If you want to write a module for some fileformat in C look at
  107. imgxxxmodule.c. If you want to add an internal format look at
  108. imgformatmodule.c and imgconvert.py.
  109.  
  110. Things I am very interested in:
  111. - Support for more image formats.
  112. - A colormapper that produces reasonable quality without being as
  113.   doggish as the FS mapper included
  114. - A better greyscale to monochrome converter.
  115.  
  116. Authors
  117. -------
  118.  
  119. The modules here were written by Jack Jansen and Sjoerd Mullender,
  120. Centrum voor Wiskunde en Informatica.
  121.  
  122. Some code in various modules was modified from code available to the
  123. public, so parts of the code were written (and possibly copyrighted)
  124. by Jeff Poskanzer, Sun Microsystems, Patrick J. Naughton, David
  125. Koblas, David Rowley, Marcel Wijkstra, CompuServe Incorporated,
  126. Spencer W. Thomas, Jim McKie, Steve Davies, Ken Turkowski, James
  127. A. Woods and Joe Orost. The relevant source files have the exact
  128. attribution and copyright status.
  129.  
  130. Complaints, bugs, fixes and other remarks can be sent to
  131. jack@cwi.nl. I'm especially interested in feedback on the interface,
  132. maybe we could discuss it in image-sig@python.org, or comp.lang.python
  133. alias the python-list@cwi.nl.
  134.  
  135.                 Jack Jansen
  136.                 CWI
  137.                 August 1995.
  138.                 
  139.